You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
502 B
16 lines
502 B
import { deleteProject, getProject } from "../../service/projects";
|
|
|
|
export default defineWrappedResponseHandler(async (event) => {
|
|
const id = parseInt(getRouterParam(event, "id") || "");
|
|
if (!id || isNaN(id)) {
|
|
throw createError({ statusCode: 400, statusMessage: "无效的项目 ID" });
|
|
}
|
|
|
|
const existing = await getProject(id);
|
|
if (!existing) {
|
|
throw createError({ statusCode: 404, statusMessage: "项目不存在" });
|
|
}
|
|
|
|
await deleteProject(id);
|
|
return R.success(null);
|
|
});
|
|
|